<?php
class articleController extends RPHP_Controller
{

    public function index()
    {

        $m    = $this->model;
        $user = $m->checkAuth();
        if ($user) {
            $this->view->user = $user;

            $data         = array();
            $data['code'] = 900;

            if (intval($_GET['page']) > 0) {
                $page = intval($_GET['page']);
            } else {
                $page = 1;
            }

            $data             = $m->post_news($page);
            $this->view->data = $data;
            $this->display();
        }

    }

    //新闻详细页
    public function show()
    {
        $m    = $this->model;
        $user = $m->checkAuth();
        if ($user) {

            // print_r($user);
            $this->view->user = $user;
            if ($_GET['id']) {
                $id = intval($_GET['id']);
            }

            $this->view->data = $m->getShow($id);
            $this->display();

        }

    }

}
